home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6027 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: keats.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: string and NULL :ques
  5. Date: 21 Feb 1996 15:03:29 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4gg8c1INNimh@keats.ugrad.cs.ubc.ca>
  8. References: <4g5flf$bil@gail.ripco.com> <4gd60bINNk22@keats.ugrad.cs.ubc.ca> <Pine.A32.3.91.960221002007.156335F-100000@black.weeg.uiowa.edu>
  9. NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
  10.  
  11. In article <Pine.A32.3.91.960221002007.156335F-100000@black.weeg.uiowa.edu>,
  12. The Amorphous Mass  <robinson@blue.weeg.uiowa.edu> wrote:
  13.  >On 20 Feb 1996, Kazimir Kylheku wrote:
  14.  >
  15.  >> In article <4g5flf$bil@gail.ripco.com>,
  16.  >> Martin Ambuhl <mambuhl@ripco.com> wrote:
  17.  >>  >If you want to work on a char array which does not contain a null
  18.  >>  >character, how do you propose to tell the library functions where it
  19.  >>  >ends?
  20.  >>  >
  21.  >>  >One possible result of using the library functions on such a char array
  22.  >>  >is a segfault.  On M$BrokenOS, the results are completely unpredictable,
  23.  >>  >since there is no protection against access (including writing) of
  24.  >>  >regions containing other data, your program, or even portions of the OS.
  25.  >> 
  26.  >> Well, even under a good OS, you still can only detect overruns to the accuracy
  27.  >> of a page size.
  28.  >
  29.  >  And under VMS, you can detect overruns immediately past the end of the 
  30.  >array.  That's one of the admittedly few things I like about coding on 
  31.  >VMS. ;)
  32.  
  33. This is probably a benefit of a segmented and paged architecture to which VMS
  34. is tied. It is not portable to all memory management hardware. You can do it
  35. under 80386 and its offspring, but you only have a limited number of segments
  36. available in the descriptor table, so the number of objects that can thus be
  37. protected is extremely limited in comparison to the address space. Such
  38. segmentation might not even be available at all on your typical RISC machine.
  39. -- 
  40.  
  41.